<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <style>
        .parent {
            width: 200px;
            height: 200px;
            background: red;
        }

        .child {
            width: 100px;
            height: 100px;
            background: yellow;
            margin: 50px;
        }
    </style>
</head>

<body>
    <div class="parent" id="parent">
        <div class="child" id="child">

        </div>
    </div>
    <script>
        var parent = document.getElementById("parent");
        var child = document.getElementById("child");
        child.addEventListener('click', function () {
            alert("child");
        }, true)
        parent.addEventListener('click', function () {
            alert("parent");
        }, true)
    </script>
</body>

</html>